package search;

/**
 * Created with IntelliJ IDEA.
 * ClassName: LinearSerachTest
 * Package: search
 * Description:
 * User: fzykd
 *
 * @Author: LQH
 * Date: 2023-08-16
 * Time: 9:53
 */

//查找 顺序查找
public class LinearSearchTest {
    public static void main(String[] args) {

        int[] arr = {4, 5, 6, 1, 9};

        int target = 5;
        boolean isFlag = true;
        for (int i = 0; i < arr.length; i++) {
            if (target == arr[i]) {
                System.out.println("找到了 " + target + "索引位置" + i);
                isFlag = false;
                break;
            }
        }

        if (isFlag){
            System.out.println("没找到");
        }

    }
}
